package ofpof.service.timers;

import java.util.Date;

import ofpof.domain.dao.SessionDao;

import org.springframework.beans.factory.annotation.Autowired;

public class SessionExpiryJob {
	
	private long sessionExpiryTimeout;
	
	@Autowired
	private SessionDao sessionDao;
	
	public void expire() {
		Date boundaryDate = new Date(new Date().getTime()-sessionExpiryTimeout);
		sessionDao.deleteOlderThan(boundaryDate);
	}

	public void setSessionExpiryTimeout(long sessionExpiryTimeout) {
		this.sessionExpiryTimeout = sessionExpiryTimeout;
	}

}
